import Vue from 'vue'
import App from './App.vue'
import router from '@/router'
import store from './store'
//注册全局组件
import TypeNav from '@/components/TypeNav/index.vue'
import Pagination from '@/components/Pagination/index.vue'
import * as api from '@/utils/api.js'
//引入mockserver虚拟数据
import '@/mock/mockServe'
//引入swiper样式
import 'swiper/css/swiper.css'
import {MessageBox, Message} from 'element-ui'
import LazyLoad from 'vue-lazyload'
import img from '@/assets/bg.gif'
import myPlugins from './myPlugins'
//引入校验插件
import './validate'
//参数1是组件名,参数2是组件
Vue.component(TypeNav.name,TypeNav)
Vue.component(Pagination.name,Pagination)
Vue.use(LazyLoad,{
  loading:img //默认加载图片
})
//调用封装的自定义指令
Vue.use(myPlugins)
Vue.config.productionTip = false
//触发VUEX中的请求侧边栏数据方法
store.dispatch("categoryList");
new Vue({
  render: h => h(App),
  beforeCreate() {
    Vue.prototype.$bus=this
    Vue.prototype.$api=api
    Vue.prototype.$msgbox = MessageBox;
    Vue.prototype.$alert = MessageBox.alert;
    Vue.prototype.$confirm = MessageBox.confirm;
    Vue.prototype.$prompt = MessageBox.prompt;
    Vue.prototype.$message = Message;
  },
  router,
  store
}).$mount('#app')
